﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class SystemManager_paymentmode : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        EntityOprHelper helper = new EntityOprHelper();
        T_PAYMENTMODE webinfo = helper.GetEntityByWhere<T_PAYMENTMODE>(" WHERE ID>=0 ORDER BY ID DESC");

        if (webinfo != null)
        {
            recordid.Text = webinfo.ID.ToString();
            this.content.InnerHtml = webinfo.TEXTVALUE;
        }
    }
    protected void Submit_Click(object sender, EventArgs e)
    {
        //保存
        String webID = recordid.Text;
        if (webID == null || webID == "")
        {
            EntityOprHelper helper = new EntityOprHelper();
            T_PAYMENTMODE webinfo = new T_PAYMENTMODE();
            webinfo.TEXTVALUE = content.InnerText;
            bool b = helper.AddEntity<T_PAYMENTMODE>(webinfo);
            if (b)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('修改成功!')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('修改失败!')", true);
            }
        }
        else
        {
            EntityOprHelper helper = new EntityOprHelper();
            T_PAYMENTMODE webinfo = new T_PAYMENTMODE();
            webinfo.TEXTVALUE = content.InnerHtml;
            webinfo.ID = Convert.ToInt32(webID);
            bool b = helper.EditEntity<T_PAYMENTMODE>(webinfo);
            if (b)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('修改成功!')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('修改失败!')", true);
            }
        }
    }
}
